unit get_win;
interface

uses Objects, WinTypes, WinProcs,Wincrt,Windos,Strings,
     CartoCmds,
     tit_win;


function min(x,y:integer):integer;
function max(x,y:integer):integer;

function EST_PROC:integer;
procedure emsg(nompr:string;erreur:integer);

FUNCTION MINUSCULE(lettre:CHAR):CHAR;
function _getnam(Filename:string; var nam:string): integer ;
function _getpath_File(Filename:string; var path:string): integer ;


{****************************************************************************}

implementation

function min;        EXTERNAL 'TERA_LIB' INDEX 20;
function max;        EXTERNAL 'TERA_LIB' INDEX 21;

function EST_PROC:integer;
var adr1,adr2,valu:integer;
begin
(*
        license := '93.00.61';
        writeln('License number : ',license);
	writeln; writeln;
        val(copy(license,7,1), adr1, ier); '6'
        val(copy(license,8,1), adr2, ier); '1'
        adr := adr1+adr2;
        val(copy(license,1,2), adr1, ier);  '93'
        val(copy(license,4,2), adr2, ier);  '00'
        valu := adr1-adr2;
        val(copy(license,7,2), adr1, ier);
	valu := 256*adr1 + valu;
	writeln ('Writing ',valu,' in location ',adr,' of memory key');
	retour := ecriture(adr,valu);
*)
        val(copy(license_text,1,2),adr1,ier);
        val(copy(license_text,4,2),adr2,ier);
{        adr1 := 94; adr2 := 0; (*00*)     }
        valu := adr1-adr2;
        val(copy(license_text,7,2),adr1,ier);
{        adr1 := 61;       }
	EST_PROC := 256*adr1 + valu;
        val(copy(license_text,7,1),adr1,ier);
        val(copy(license_text,8,1),adr2,ier);
        adr_proc := adr1 + adr2;
{        adr_proc :=  6 + 1;    }
end;

procedure emsg(nompr:string;erreur:integer);
begin

      LoadString(HInstance, stW_CARTOTr+Lang, @MessageText, 79);
      LoadString(HInstance, stW_CARTOErr2+Lang, @TitleText, 79);
      str(erreur,strw);
      _writeln(StrPas(MessageText)+StrPas(TitleText)+strw+' : '+nompr);
(*
      writeln(StrPas(MessageText)+StrPas(TitleText)+strw+' : '+nompr);
*)
end;

FUNCTION MINUSCULE;         EXTERNAL 'TERA_LIB' INDEX 22;
function _getnam;           EXTERNAL 'TERA_LIB' INDEX 23;
function _getpath_File;     EXTERNAL 'TERA_LIB' INDEX 24;

end.
